/*
 * Address.cpp
 *
 *  Created on: 04 Ιουν 2010
 *      Author: Sartios
 */

#include "Address.h"

Address::Address() {
	town_ = NULL;
	street_ = NULL;
	number_ = NULL;
}

Address::~Address() {
	delete town_;
	delete street_;
	delete number_;
}

Address::Address(const string *town,const string *street,const string *number){
	if((NULL!=town)&&(NULL!=street)&&(NULL!=number)){
		setTown(town);
		setStreet(street);
		setNumber(number);
	}
}

Address::Address(const IAddress *address){
	if(NULL!=address){
		const string TOWN = *address->getTown();
		const string STREET = *address->getStreet();
		const string NUMBER = *address->getNumber();

		setTown(&TOWN);
		setStreet(&STREET);
		setNumber(&NUMBER);
	}
}

void Address::setTown(const string *town){
	if(NULL!=town){
		town_ = new string(*town);
	}
}

string * Address::getTown()const{
	return town_;
}

void Address::setStreet(const string *street){
	if(NULL!=street){
		street_ = new string(*street);
	}
}

string * Address::getStreet()const{
	return street_;
}

void	Address::setNumber(const string *number){
	if(NULL!=number){
		number_ = new string(*number);
	}
}

string * Address::getNumber()const{
	return number_;
}
